home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / OWLINC.PAK / DIBITMAP.H < prev    next >
C/C++ Source or Header  |  1997-05-06  |  3KB  |  134 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows
  3. // Copyright (c) 1995, 1997 by Borland International, All Rights Reserved
  4. //
  5. //$Revision:   10.6  $
  6. //
  7. // Definition of DeviceIndependent Bitmap object class
  8. //----------------------------------------------------------------------------
  9. #if !defined(OWL_DIBITMAP_H)
  10. #define OWL_DIBITMAP_H
  11.  
  12. #if !defined(OWL_GDIOBJEC_H)
  13. # include <owl/gdiobjec.h>
  14. #endif
  15.  
  16. #if defined(BI_NAMESPACE)
  17. namespace OWL {
  18. #endif
  19.  
  20. // Generic definitions/compiler options (eg. alignment) preceeding the 
  21. // definition of classes
  22. #include <services/preclass.h>
  23.  
  24. //
  25. // class TDiBitmap
  26. // ~~~~~ ~~~~~~~~~
  27. // The TDiBitmap class is a combination of a TDib and a TBitmap. It can be
  28. // constructed and manipulated like a TDib, but it can also be selected into
  29. // a dc and manipulated with GDI. To guarantee functionality on all platforms,
  30. // the TDibDC should be used as the memory dc to hold a TDiBitmap
  31. //
  32. class _OWLCLASS TDiBitmap : public TBitmap, public TDib {
  33.   public:
  34.     // Constructors and destructor
  35.     //
  36.     TDiBitmap(HGLOBAL handle, TAutoDelete autoDelete = NoAutoDelete);
  37.     TDiBitmap(const TClipboard& clipboard);
  38.     TDiBitmap(const TDib& src);
  39.  
  40.     TDiBitmap(int width, int height, int nColors, uint16 mode=DIB_RGB_COLORS);
  41.     TDiBitmap(HINSTANCE module, TResId resid);
  42.     TDiBitmap(const char* name);
  43.     TDiBitmap(TFile& file, bool readFileHeader = true);
  44. #if !defined(BI_DATA_NEAR)
  45.     TDiBitmap(istream& is, bool readFileHeader = false);
  46. #endif
  47.     TDiBitmap(const TBitmap& bitmap, const TPalette* pal = 0);
  48.    ~TDiBitmap();
  49.  
  50.     int         Width() const;
  51.     int         Height() const;
  52.     TSize       Size() const;
  53.     int         BitsPixel() const;
  54.  
  55.   protected:
  56.     void InitBitmap();
  57. };
  58.  
  59. //
  60. // class TIdentityPalette
  61. // ~~~~~ ~~~~~~~~~~~~~~~~
  62. // An identity palette is a palette where the colors and order of those colors
  63. // match the physical palette.
  64. // Use the identity palette whenever possible, because if the system does not
  65. // have to map colors, it can speed bitmap drawing.
  66. //
  67. class _OWLCLASS TIdentityPalette : public TPalette {
  68.   public:
  69.     TIdentityPalette(const TPalette& palette);
  70. };
  71.  
  72. //
  73. // class THalftonePalette
  74. // ~~~~~ ~~~~~~~~~~~~~~~~
  75. // A halftone palette is intended for use when the stretching mode of a
  76. // device context is set to HALFTONE.
  77. //
  78. class _OWLCLASS THalftonePalette : public TPalette {
  79.   public:
  80.     THalftonePalette();
  81. };
  82.  
  83. // Generic definitions/compiler options (eg. alignment) following the 
  84. // definition of classes
  85. #include <services/posclass.h>
  86.  
  87. #if defined(BI_NAMESPACE)
  88. } // namespace OWL
  89. #endif
  90.  
  91. //----------------------------------------------------------------------------
  92. // Inline implementations
  93. //
  94.  
  95. //
  96. // Return the width of the dib.
  97. //
  98. inline int
  99. TDiBitmap::Width() const
  100. {
  101.   return TDib::Width();
  102. }
  103.  
  104. //
  105. // Return the height of the dib.
  106. //
  107. inline int
  108. TDiBitmap::Height() const
  109. {
  110.   return TDib::Height();
  111. }
  112.  
  113. //
  114. // Return the size of the dib.
  115. //
  116. inline TSize
  117. TDiBitmap::Size() const
  118. {
  119.   return TDib::Size();
  120. }
  121.  
  122. //
  123. // Return number of bits to hold each pixel.
  124. //
  125. inline int
  126. TDiBitmap::BitsPixel() const
  127. {
  128.   return TDib::BitsPixel();
  129. }
  130.  
  131.  
  132.  
  133. #endif  // OWL_DIBITMAP_H
  134.